local background = Color(0,0,0,175)
local backgroundhead = Color(0,0,0,175)
local border = Color(61,255,255,255)
local phys = Color(255,204,51,250)
local phystrans = Color(255,204,51,50)
local mouse1 = Color(51,255,51,250)
local mouse2 = Color(255,51,0,250)
local header = Color(51,51,255,255)

bOpen = false

hook.Add("HUDPaint", "HNS_BlockPlacer", function()

	if bOpen then
		--Lower Entity Window BackGround
			surface.SetDrawColor( background );
			draw.RoundedBoxEx( 6, 22, ScrH()-170, 613, 19, background, true, true, false, false);
			surface.DrawRect ( 20, ScrH()-151, ScrW()-40, 147 );
			surface.DrawOutlinedRect ( 20, ScrH()-151, ScrW()-40, 147 );

			
		--Placement Options BackGround
			surface.DrawRect( ScrW()-270, ScrH()-700, 250,542);
			surface.DrawOutlinedRect( ScrW()-270, ScrH()-700, 250,542);	
			
		--Little VGUI TAB
			draw.RoundedBoxEx( 4, ScrW()-285, ScrH()-650, 15, 50, background, true, false, true, false)
			surface.DrawOutlinedRect( ScrW()-285, ScrH()-650, 15, 50 )
			draw.SimpleText("V", "MenuFont2", ScrW()-281, ScrH()-647, Color(255,255,255,125), TEXT_ALIGN_LEFT)
			draw.SimpleText("G", "MenuFont2", ScrW()-281, ScrH()-636, Color(255,255,255,125), TEXT_ALIGN_LEFT)
			draw.SimpleText("U", "MenuFont2", ScrW()-280, ScrH()-625, Color(255,255,255,125), TEXT_ALIGN_LEFT)
			draw.SimpleText("I", "MenuFont2", ScrW()-278, ScrH()-614, Color(255,255,255,125), TEXT_ALIGN_LEFT)
			
		--Miscellaneous Header
			draw.RoundedBoxEx( 6, ScrW()-260, ScrH()-687, 230, 20, backgroundhead, true, true, false, false);
			draw.SimpleText("MISCELLANEOUS", "MenuFont5", ScrW()-195, ScrH()-684, Color(255,255,255,255))	
			
		--Block Type Header
			draw.RoundedBoxEx( 6, ScrW()-260, ScrH()-490, 229, 20, backgroundhead, true, true, false, false);
			draw.SimpleText("BLOCK SIZE", "MenuFont5", ScrW()-184, ScrH()-488, Color(255,255,255,255))
			
		--Rotation Header
			draw.RoundedBoxEx( 6, ScrW()-260, ScrH()-286, 229, 20, backgroundhead, true, true, false, false);
			draw.SimpleText("ROTATION", "MenuFont5", ScrW()-177, ScrH()-283, Color(255,255,255,255))
	end
	
end)

usermessage.Hook("BlockPlacer", function(um)

	if bOpen then bOpen = false else bOpen = true end

	
	if bOpen then
	
		MainFrame = vgui.Create( "DFrame" )
        MainFrame:SetSize( 1, 1 )
		MainFrame:SetPos( 25, 25 )
        MainFrame:SetTitle( "" )
		MainFrame:SetDraggable(false)
		MainFrame:ShowCloseButton(true)
        MainFrame:SetVisible(true)
        MainFrame:MakePopup()
		MainFrame:SetMouseInputEnabled( false )

		------------------------------------Tabs for different block types------------------------------------------

		PropertySheet = vgui.Create( "DPropertySheet", MainFrame )
		PropertySheet:SetParent( DermaPanel )
		PropertySheet:SetPos( 25, ScrH()-166)
		PropertySheet:SetSize(  ScrW()-50, 156 )
		PropertySheet:SetPadding(  5 )
		 
		 
		SheetItemOne = vgui.Create( "DPanel", MainFrame )
		SheetItemOne:SetPos( 5, 5 )
		SheetItemOne:SetSize( 128, 128 ) 
		SheetItemOne:SizeToContents()


		SheetItemOne.Paint = function()
			surface.SetDrawColor( background ); 
			surface.DrawRect( 5, 5, 128, 128 )
		end
		 
		PropertySheet:AddSheet( "All", SheetItemOne, "gui/silkicons/user", false, false, "Every HNS Block." )
		PropertySheet:AddSheet( "Primary", SheetItemOne, "gui/silkicons/group", false, false, "Elementary building blocks." ) 
		PropertySheet:AddSheet( "Movement", SheetItemOne, "gui/silkicons/group", false, false, "Blocks that change/impair a players movement." ) 
		PropertySheet:AddSheet( "Damage", SheetItemOne, "gui/silkicons/group", false, false, "Blocks that do damage." ) 
		PropertySheet:AddSheet( "Power Ups", SheetItemOne, "gui/silkicons/group", false, false, "All buffs/power ups can be found here." ) 
		PropertySheet:AddSheet( "Weapons", SheetItemOne, "gui/silkicons/group", false, false, "All blocks that give weapons/nades" ) 
		PropertySheet:AddSheet( "Teleport", SheetItemOne, "gui/silkicons/group", false, false, "Creates a Portal" ) 


		--------------------------------------Rotation boxes Left side---------------------------------------------
		rotationleft = vgui.Create( "DForm", DermaPanel )
		rotationleft:SetPos( ScrW()-260, ScrH()-266)
		rotationleft:SetSize( 115, 1 )
		rotationleft:SetSpacing( 1 )
		rotationleft:SetName( "" )
		rotationleft:SetMouseInputEnabled(false)


		rotationleft.Paint = function()
			surface.SetDrawColor( border )
			surface.DrawRect( 1, 22, rotationleft:GetWide()-2, 2) 
			surface.DrawOutlinedRect( 0, 0, rotationleft:GetWide(), rotationleft:GetTall()) 
			surface.SetDrawColor( background )
			surface.DrawRect( 0, 0, rotationleft:GetWide(), rotationleft:GetTall() ) 
			draw.SimpleText("Mouse1", "MenuFont5", 40, 5, mouse1, TEXT_ALIGN_LEFT)
		end

		FormContentOne = vgui.Create ( "DCheckBoxLabel", MainFrame  )
		FormContentOne:SetText( "Flip Up Right" )
		--FormContentOne:SetConVar("notyet")
		FormContentOne:SetValue(0)
		FormContentOne:SizeToContents()
		rotationleft:AddItem( FormContentOne )	


		FormContentOne = vgui.Create ( "DCheckBoxLabel", MainFrame  )
		FormContentOne:SetText( "90 Degrees" )
		--FormContentOne:SetConVar("notyet")
		FormContentOne:SetValue(0)
		FormContentOne:SizeToContents()
		rotationleft:AddItem( FormContentOne )	

		FormContentOne = vgui.Create ( "DCheckBoxLabel", MainFrame  )
		FormContentOne:SetText( "180 Degrees" )
		--FormContentOne:SetConVar("notyet")
		FormContentOne:SetValue(0)
		FormContentOne:SizeToContents()
		rotationleft:AddItem( FormContentOne )	

		---------------------------------------Rotation Boxes Right side-----------------------------------------------

		rotationright = vgui.Create( "DForm", DermaPanel )
		rotationright:SetPos( ScrW()-144, ScrH()-266)
		rotationright:SetSize( 113, 1 )
		rotationright:SetSpacing( 1 )
		rotationright:SetName( "" )
		rotationright:SetMouseInputEnabled(false)

		rotationright.Paint = function()
			surface.SetDrawColor( border )
			surface.DrawRect( 1, 22, rotationright:GetWide()-2, 2) 
			surface.DrawOutlinedRect( 0, 0, rotationright:GetWide(), rotationright:GetTall()) 
			surface.SetDrawColor( background )
			surface.DrawRect( 0, 0, rotationright:GetWide(), rotationright:GetTall() ) 
			draw.SimpleText("Mouse2", "MenuFont5", 40, 5, mouse2, TEXT_ALIGN_LEFT)

		end

		FormContentOne = vgui.Create ( "DCheckBoxLabel", MainFrame  )
		FormContentOne:SetText( "Flip Up Right" )
		--FormContentOne:SetConVar("notyet")
		FormContentOne:SetValue(0)
		FormContentOne:SizeToContents()
		rotationright:AddItem( FormContentOne )	


		FormContentOne = vgui.Create ( "DCheckBoxLabel", MainFrame  )
		FormContentOne:SetText( "90 Degrees" )
		--FormContentOne:SetConVar("notyet")
		FormContentOne:SetValue(0)
		FormContentOne:SizeToContents()
		rotationright:AddItem( FormContentOne )	

		FormContentOne = vgui.Create ( "DCheckBoxLabel", MainFrame  )
		FormContentOne:SetText( "180 Degrees" )
		--FormContentOne:SetConVar("notyet")
		FormContentOne:SetValue(0)
		FormContentOne:SizeToContents()
		rotationright:AddItem( FormContentOne )	




		-----------------------------------BLOCK TYPE WINDOW LEFT---------------------

		blocktypeleft = vgui.Create( "DForm", DermaPanel )
		blocktypeleft:SetPos( ScrW()-260, ScrH()-471)
		blocktypeleft:SetSize( 115, 1 )
		blocktypeleft:SetSpacing( 1 )
		blocktypeleft:SetName( "" )
		blocktypeleft:SetMouseInputEnabled(false)

		blocktypeleft.Paint = function()
			surface.SetDrawColor( border )
			surface.DrawRect( 1, 22, blocktypeleft:GetWide()-2, 2) 
			surface.DrawOutlinedRect( 0, 0, blocktypeleft:GetWide(), blocktypeleft:GetTall()) 
			surface.SetDrawColor( background )
			surface.DrawRect( 0, 0, blocktypeleft:GetWide(), blocktypeleft:GetTall() ) 
			draw.SimpleText("Mouse1", "MenuFont5", 40, 5, mouse1, TEXT_ALIGN_LEFT)
		end

		FormContentOne = vgui.Create ( "DCheckBoxLabel", MainFrame  )
		FormContentOne:SetText( "Small" )
		--FormContentOne:SetConVar("notyet")
		FormContentOne:SetValue(0)
		FormContentOne:SizeToContents()
		blocktypeleft:AddItem( FormContentOne )	

		FormContentOne = vgui.Create ( "DCheckBoxLabel", MainFrame  )
		FormContentOne:SetText( "Normal" )
		--FormContentOne:SetConVar("notyet")
		FormContentOne:SetValue(0)
		FormContentOne:SizeToContents()
		blocktypeleft:AddItem( FormContentOne )	

		FormContentOne = vgui.Create ( "DCheckBoxLabel", MainFrame  )
		FormContentOne:SetText( "Large" )
		--FormContentOne:SetConVar("notyet")
		FormContentOne:SetValue(0)
		FormContentOne:SizeToContents()
		blocktypeleft:AddItem( FormContentOne )	

		FormContentOne = vgui.Create ( "DCheckBoxLabel", MainFrame  )
		FormContentOne:SetText( "Pole" )
		--FormContentOne:SetConVar("notyet")
		FormContentOne:SetValue(0)
		FormContentOne:SizeToContents()
		blocktypeleft:AddItem( FormContentOne )	

		FormContentOne = vgui.Create ( "DCheckBoxLabel", MainFrame  )
		FormContentOne:SetText( "Plate" )
		--FormContentOne:SetConVar("notyet")
		FormContentOne:SetValue(0)
		FormContentOne:SizeToContents()
		blocktypeleft:AddItem( FormContentOne )	

		FormContentOne = vgui.Create ( "DCheckBoxLabel", MainFrame  )
		FormContentOne:SetText( "Micro" )
		--FormContentOne:SetConVar("notyet")
		FormContentOne:SetValue(0)
		FormContentOne:SizeToContents()
		blocktypeleft:AddItem( FormContentOne )	


		-----------------------------------BLOCK TYPE WINDOW RIGHT---------------------


		blocktyperight = vgui.Create( "DForm", DermaPanel )
		blocktyperight:SetPos( ScrW()-144, ScrH()-471)
		blocktyperight:SetSize( 113, 1 )
		blocktyperight:SetSpacing( 1 )
		blocktyperight:SetName( "" )
		blocktyperight:SetMouseInputEnabled(false)

		blocktyperight.Paint = function()
			surface.SetDrawColor( border )
			surface.DrawRect( 1, 22, blocktypeleft:GetWide()-2, 2) 
			surface.DrawOutlinedRect( 0, 0, blocktyperight:GetWide(), blocktyperight:GetTall()) 
			surface.SetDrawColor( background )
			surface.DrawRect( 0, 0, blocktyperight:GetWide(), blocktyperight:GetTall() ) 
			draw.SimpleText("Mouse2", "MenuFont5", 40, 5, mouse2, TEXT_ALIGN_LEFT)
		end

		FormContentOne = vgui.Create ( "DCheckBoxLabel", MainFrame  )
		FormContentOne:SetText( "Small" )
		--FormContentOne:SetConVar("notyet")
		FormContentOne:SetValue(0)
		FormContentOne:SizeToContents()
		blocktyperight:AddItem( FormContentOne )	

		FormContentOne = vgui.Create ( "DCheckBoxLabel", MainFrame  )
		FormContentOne:SetText( "Normal" )
		--FormContentOne:SetConVar("notyet")
		FormContentOne:SetValue(0)
		FormContentOne:SizeToContents()
		blocktyperight:AddItem( FormContentOne )	

		FormContentOne = vgui.Create ( "DCheckBoxLabel", MainFrame  )
		FormContentOne:SetText( "Large" )
		----FormContentOne:SetConVar("notyet")
		FormContentOne:SetValue(0)
		FormContentOne:SizeToContents()
		blocktyperight:AddItem( FormContentOne )	

		FormContentOne = vgui.Create ( "DCheckBoxLabel", MainFrame  )
		FormContentOne:SetText( "Pole" )
		----FormContentOne:SetConVar("notyet")
		FormContentOne:SetValue(0)
		FormContentOne:SizeToContents()
		blocktyperight:AddItem( FormContentOne )	

		FormContentOne = vgui.Create ( "DCheckBoxLabel", MainFrame  )
		FormContentOne:SetText( "Plate" )
		----FormContentOne:SetConVar("notyet")
		FormContentOne:SetValue(0)
		FormContentOne:SizeToContents()
		blocktyperight:AddItem( FormContentOne )	

		FormContentOne = vgui.Create ( "DCheckBoxLabel", MainFrame  )
		FormContentOne:SetText( "Micro" )
		----FormContentOne:SetConVar("notyet")
		FormContentOne:SetValue(0)
		FormContentOne:SizeToContents()
		blocktyperight:AddItem( FormContentOne )	



		-----------------------------------------MISCELLANEOUS WINDOW--------------------------------------

		trampoline = vgui.Create( "DForm", DermaPanel )
		trampoline:SetPos( ScrW()-260, ScrH()-667)
		trampoline:SetSize( 230, 1 )
		trampoline:SetSpacing( 5 )
		trampoline:SetName( "" )
		trampoline:SetMouseInputEnabled(false)

		trampoline.Paint = function()
			surface.SetDrawColor( border )
			surface.DrawRect( 1, 22, trampoline:GetWide()-2, 2) 
			surface.DrawOutlinedRect( 0, 0, trampoline:GetWide(), trampoline:GetTall()) 
			surface.SetDrawColor( background )
			surface.DrawRect( 0, 0, trampoline:GetWide(), trampoline:GetTall() ) 
			draw.SimpleText("Physgun Placement", "MenuFont2", 63, 5, phys, TEXT_ALIGN_LEFT)
			draw.SimpleText("Stay on Grid", "MenuFont2", 118, 30, phystrans, TEXT_ALIGN_LEFT)
			draw.SimpleText("Snaps to Brushes", "MenuFont2", 118, 55, phystrans, TEXT_ALIGN_LEFT)
			draw.SimpleText("Auto Centers in Block", "MenuFont2", 118, 80, phystrans, TEXT_ALIGN_LEFT)
		end

		FormContentOne = vgui.Create ( "DCheckBoxLabel", MainFrame  )
		FormContentOne:SetText( "Place on Grid" )
		----FormContentOne:SetConVar("notyet")
		FormContentOne:SetValue(0)
		FormContentOne:SizeToContents()
		trampoline:AddItem( FormContentOne )

		FormContentOne = vgui.Create ( "DCheckBoxLabel", MainFrame  )
		FormContentOne:SetText( "Snap to World" )
		----FormContentOne:SetConVar("notyet")
		FormContentOne:SetValue(0)
		FormContentOne:SizeToContents()
		trampoline:AddItem( FormContentOne )

		FormContentOne = vgui.Create ( "DCheckBoxLabel", MainFrame  )
		FormContentOne:SetText( "Center In block" )
		----FormContentOne:SetConVar("notyet")
		FormContentOne:SetValue(0)
		FormContentOne:SizeToContents()
		trampoline:AddItem( FormContentOne )



		FormContentOne = vgui.Create ( "DNumSlider", MainFrame  )
		FormContentOne:SetText( "Trampoline Power" )
		--FormContentOne:SetConVar( "notyet" )
		FormContentOne:SetValue( 0 )
		FormContentOne:SizeToContents( 1 )
		FormContentOne:SetMin( 0 )
		FormContentOne:SetMax( 10000 )
		FormContentOne:SetDecimals( 0 )
		trampoline:AddItem( FormContentOne )	

		FormContentOne = vgui.Create ( "DCheckBoxLabel", MainFrame  )
		FormContentOne:SetText( "No Collide" )
		----FormContentOne:SetConVar("notyet")
		FormContentOne:SetValue(0)
		FormContentOne:SizeToContents()
		trampoline:AddItem( FormContentOne )	

	end
end)


